{extend name="$LAYOUT_WECHAT_BASE" /}
{block name="title"}收货地址管理 - {__block__}{/block}
{block name="css"}
<link rel="stylesheet"  href="__WECHAT__/css/address.css?v={$v}">
{/block}
{block name="header"}
    <header style="background:#ffffff;" class="ui-header ui-header-positive wst-header js-address">
        <i class="ui-icon-return" {if($type==1)}onclick="javascript:chooseAddress({$addressId});"{else}onclick="history.back();"{/if}></i><h1>我的地址</h1>
    </header>
{/block}
{block name="footer"}
	<div class="wst-ad-footer js-address"><button class="button" onclick="javascript:editAddress(0);">新增</button></div>
{/block}
{block name="main"}
	 <input type="hidden" name="" value="{$type}" id="type" autocomplete="off">
	 <input type="hidden" name="" value="{$addressId}" id="addressId2" autocomplete="off">
     <section class="ui-container js-address" id="address">
     	{volist name="list" id="li"}
            <ul class="ui-list wst-listse">
	            <li {if($type==1)}onclick="javascript:chooseAddress({$li['addressId']});"{/if}>
		            <div class="wst-list-infose1">
			            <span class="name">{$li['userName']}&nbsp;&nbsp;{$li['userPhone']}</span>
			            <span class="address">{$li['areaName']}-{$li['userAddress']}</span>
		            </div>
	            </li>
	            <div class="wst-ad-operate">
	            	{if($type!=1)}<span class="left">设为默认</span>{/if}
	            	<span class="right" onclick="javascript:delAddress({$li['addressId']});"><i class="delete"></i>&nbsp;删除</span>
	            	<span class="right" onclick="javascript:editAddress({$li['addressId']});"><i class="edit"></i>&nbsp;编辑</span>
	            	<div class="wst-clear"></div>
	            </div>
            </ul>
            {if($type==1)}
            	<i class="j-operate {if($addressId==$li['addressId'])}default{else}nodefault{/if}"></i>
            {else}
            	<i class="j-operate {if($li['isDefault']==1)}default{else}nodefault{/if}" onclick="javascript:inDefault(this,{$li['addressId']});"></i>
            {/if}
        {/volist}
	       {empty name="list"}
        	<div class="wst-prompt-icon"><img src="__WECHAT__/img/nothing-address.png"></div>
			<div class="wst-prompt-info">
				<p>没有收货地址</p>
			</div>
	       {/empty}
     </section>
{/block}
{block name="include"}
{include file="$LAYOUT_WECHAT_DIALOG" /}<!-- 对话框模板 -->
{include file="./wechat/index/useraddress/edit" /}<!-- 新增/编辑收货地址模板 -->
{/block}
{block name="js"}
<script type='text/javascript' src='__WECHAT__/js/jquery.min.js'></script>
<script type='text/javascript' src='__ROOT__/addons/groupon/view/wechat/index/useraddress/address.js?v={$v}'></script>
{/block}